#include <stdio.h>
#include <string.h>
#include <iostream.h>

struct asdf
{
	char left[10];
	char right[10];
	char answer[10];
}test[4];

int check(char ch, int weight)  // 0 for light , 1 for heavy
{
	int i, j, find, len;	
	for (i=1; i<=3; ++i)
	{
		find = 0;
		len = strlen(test[i].left);
		for (j=0; j<len; j++)
			if (test[i].left[j]==ch)
			{
				find=1;
				break;
			}
		if (!find)
			for (j=0; j<len; ++j)
				if (test[i].right[j]==ch)
				{
					find=2;
					break;
				}
		if ( !find && test[i].answer[0]!='e') return 0;
		if (weight==0)
		{
			if (find==1 && test[i].answer[0]!='d') return 0; 
			if (find==2 && test[i].answer[0]!='u') return 0; 
		}
		else 
		{
			if (find==1 && test[i].answer[0]!='u') return 0; 
			if (find==2 && test[i].answer[0]!='d') return 0; 
		}


	}
	return 1;
		
}

main()
{
	int n, i, j;
	char ch;

	cin >>n;
	while (n-->0)
	{
		memset(test, 0, sizeof(test));
		for (i=1; i<=3; ++i)
			cin >>test[i].left >>test[i].right >>test[i].answer;
//		for (i=1; i<=3; ++i)
//			cout << test[i].left << test[i].right << test[i].answer << endl;
		for (ch='A'; ch<='L'; ++ch)
		{
			j=0; 
			if (check(ch,j)) break;
			j=1;
			if (check(ch,j)) break;
		}
		cout <<ch << " is the counterfeit coin and it is ";
		if (!j) cout <<"light."<<endl;
		else cout <<"heavy."<<endl;

	}

	return 0;
}